-- @owner: wan005
-- @date: 2024-11-05
-- @testpoint: mediumint(n)作为对象名测试，部分合理报错

--pre1:切换B库执行
@conn PrimaryDbBmode;

--step1:作为列名 expect:成功
drop table if exists mediumint_test cascade;
create table mediumint_test(mediumint mediumint);
insert into mediumint_test values('0');

--step2:作为索引名 expect:成功
create index on mediumint_test(mediumint);
drop table if exists mediumint_test cascade;

--step3:作为表名 expect:成功
drop table if exists mediumint cascade;
create table mediumint(mediumint mediumint);
insert into mediumint values('1');
select * from mediumint;
drop table if exists mediumint cascade;

--step4:作为数据库名 expect:成功
drop database if exists mediumint;
create database mediumint;
drop database mediumint;

--step5:作为外部数据源名 expect:成功
drop data source if exists mediumint;
create data source mediumint;
drop data source mediumint;

--step6:作为自定义函数名， expect:报错
create or replace function mediumint(c1 mediumint(100))
returns mediumint(100)
as  $$
begin
    return c1;
end;
$$language plpgsql;
/

--step7:作为存储过程名，
CREATE OR REPLACE PROCEDURE ftturr(P1 IN mediumint(100)) AS
BEGIN
insert into t_mediumint_0023 values ('00001');
raise info '测试mediumint作为存储过程名';
END;
/

--step8:作为角色名 expect:成功
drop role if exists mediumint;
create role mediumint with password 'gauss@123' valid until '2001-12-12';
drop role mediumint;

--step9:作为用户组名 expect:成功
drop group if exists mediumint;
create group mediumint with password 'gauss@123';
drop group mediumint;

--step10:作为模式名 expect:成功
drop schema if exists mediumint;
create schema mediumint;
drop schema mediumint;

--step11:作为序列名 expect:成功
create sequence public.mediumint start 100 cache 50;
drop sequence public.mediumint;

--step12:作为用户名 expect:成功
drop user if exists mediumint;
CREATE USER mediumint PASSWORD 'Bigdata@123';
drop user mediumint;

--step13:前置条件 expect:成功
drop table if exists mediumint_test cascade;
create table mediumint_test(cid int,fid int);

--step14:作为游标号名 expect:成功
start transaction;
cursor mediumint for select * from mediumint_test order by 1;
close mediumint;
end;

--step15:清理环境 expect:成功
drop table if exists mediumint_test cascade;